This is a tutorial script to producing an interactive visualization of a co-author network. The network is based on a publication list of Steno Diabetes Center Copenhagen in 2021, extracted from the Capital Region of Denmark. Each author is a node in the network, and the author’s position and vertices (connections to other authors) are dependent on, whom the author has co-authored publications with. Moreover, the total number of publications and co-author of the author are shown as additional information, when hovering the cursor over the author.
The code is for R and it is, among others, based on packages stringr, ggplot2 and plotly.
This document is part of the Github repository StenoScope by Tommi Suvitaival.
View this document at https://tommi-s.com/StenoScope/AuthorGraph/ to show all output correctly.
file.path <-
paste0(
here::here(),
"/data/publications-SDCC-2021.txt"
)
data.loaded <-
read.delim(
file = file.path, # "../data/publications-SDCC-2021.txt"
encoding = "UTF-8",
header = FALSE,
stringsAsFactors = FALSE
)
data <-
matrix(
data = unlist( data.loaded ),
ncol = 4,
byrow = TRUE
)
colnames( data ) <-
c(
"Status",
"Title",
"Info",
"Type"
)
data <-
data.frame(
data,
stringsAsFactors = FALSE
)
head( data )
## Status
## 1 Published
## 2 Published
## 3 Published
## 4 Published
## 5 Published
## 6 Published
## Title
## 1 Associations of hypoglycemia, glycemic variability and risk of cardiac arrhythmias in insulin-treated patients with type 2 diabetes: a prospective, observational study
## 2 The effectiveness of e-learning in patient education delivered to patients with rheumatoid arthritis: The WebRA study-protocol for a pragmatic randomised controlled trial
## 3 The Association Between Cardiovascular Autonomic Function and Changes in Kidney and Myocardial Function in Type 2 Diabetes and Healthy Controls
## 4 Cardiovascular Events with Finerenone in Kidney Disease and Type 2 Diabetes
## 5 Translation and validation of the Canadian assessment of physical literacy-2 in a Danish sample
## 6 Medical therapies for prevention of cardiovascular and renal events in patients with atrial fibrillation and diabetes mellitus
## Info
## 1 Andersen, A., Bagger, J. I., Sørensen, S. K., Baldassarre, M. P. A., Pedersen-Bjergaard, U., Forman, J. L., Gislason, G., Lindhardt, T. B., Knop, F. K. & Vilsbøll, T., 24 Dec 2021, In: Cardiovascular Diabetology. 20, 1, p. 241 241.
## 2 Raunsbæk Knudsen, L., Lomborg, K., Ndosi, M., Hauge, E-M. & de Thurah, A., 20 Dec 2021, In: BMC Rheumatology. 5, 1, p. 57 57.
## 3 Laursen, J. C., Rasmussen, I. K. B., Zobel, E. H., Hasbak, P., von Scholten, B. J., Holmvang, L., Ripa, R. S., Hansen, C. S., Frimodt-Moeller, M., Kjaer, A., Rossing, P. & Hansen, T. W., 13 Dec 2021, In: Frontiers in Endocrinology. 12, p. 780679 780679.
## 4 Pitt, B., Filippatos, G., Agarwal, R., Anker, S. D., Bakris, G. L., Rossing, P., Joseph, A., Kolkhof, P., Nowack, C., Schloemer, P., Ruilope, L. M., FIGARO-DKD Investigators & Pedersen-Bjergaard, U., 9 Dec 2021, In: The New England journal of medicine. 385, 24, p. 2252-2263 12 p.
## 5 Elsborg, P., Melby, P. S., Kurtzhals, M., Tremblay, M. S., Nielsen, G. & Bentsen, P., 9 Dec 2021, In: BMC PUBLIC HEALTH. 21, 1, p. 2236 2236.
## 6 Fauchier, L., Boriani, G., de Groot, J. R., Kreutz, R., Rossing, P. & Camm, A. J., 7 Dec 2021, In: Europace : European pacing, arrhythmias, and cardiac electrophysiology : journal of the working groups on cardiac pacing, arrhythmias, and cardiac cellular electrophysiology of the European Society of Cardiology. 23, 12, p. 1873-1891 19 p.
## Type
## 1 Research output: Contribution to journal › Journal article › Research › peer-review
## 2 Research output: Contribution to journal › Journal article › Research › peer-review
## 3 Research output: Contribution to journal › Journal article › Research › peer-review
## 4 Research output: Contribution to journal › Journal article › Research › peer-review
## 5 Research output: Contribution to journal › Journal article › Research › peer-review
## 6 Research output: Contribution to journal › Journal article › Research › peer-review
table( data$"Type" )
##
## Research output: Contribution to journal › Comment/debate › Research › peer-review
## 13
## Research output: Contribution to journal › Conference abstract in journal › Research › peer-review
## 6
## Research output: Contribution to journal › Editorial › Research › peer-review
## 3
## Research output: Contribution to journal › Journal article › Research › peer-review
## 278
## Research output: Contribution to journal › Letter › Research › peer-review
## 7
## Research output: Contribution to journal › Review › Research › peer-review
## 32
is.included <-
grepl(
x = data$"Type",
pattern = "(Journal article)|(Review)"
)
data <- data[ is.included, ]
# Split by the date text.
tmp <-
stringr::str_split_fixed(
string = data[ , 3 ],
pattern = "(\\,\\s([0-9]+\\s)?([A-Z][a-z][a-z]\\s)?2021\\,\\s)",
n = 2
)
colnames( tmp ) <-
c(
"Authors",
"Reference"
)
tmp <-
data.frame(
tmp,
stringsAsFactors = FALSE
)
data <-
dplyr::bind_cols(
data,
tmp
)
str( data )
## 'data.frame': 310 obs. of 6 variables:
## $ Status : chr "Published" "Published" "Published" "Published" ...
## $ Title : chr "Associations of hypoglycemia, glycemic variability and risk of cardiac arrhythmias in insulin-treated patients "| __truncated__ "The effectiveness of e-learning in patient education delivered to patients with rheumatoid arthritis: The WebRA"| __truncated__ "The Association Between Cardiovascular Autonomic Function and Changes in Kidney and Myocardial Function in Type"| __truncated__ "Cardiovascular Events with Finerenone in Kidney Disease and Type 2 Diabetes" ...
## $ Info : chr "Andersen, A., Bagger, J. I., Sørensen, S. K., Baldassarre, M. P. A., Pedersen-Bjergaard, U., Forman, J. L., Gis"| __truncated__ "Raunsbæk Knudsen, L., Lomborg, K., Ndosi, M., Hauge, E-M. & de Thurah, A., 20 Dec 2021, In: BMC Rheumatology. 5, 1, p. 57 57." "Laursen, J. C., Rasmussen, I. K. B., Zobel, E. H., Hasbak, P., von Scholten, B. J., Holmvang, L., Ripa, R. S., "| __truncated__ "Pitt, B., Filippatos, G., Agarwal, R., Anker, S. D., Bakris, G. L., Rossing, P., Joseph, A., Kolkhof, P., Nowac"| __truncated__ ...
## $ Type : chr "Research output: Contribution to journal › Journal article › Research › peer-review" "Research output: Contribution to journal › Journal article › Research › peer-review" "Research output: Contribution to journal › Journal article › Research › peer-review" "Research output: Contribution to journal › Journal article › Research › peer-review" ...
## $ Authors : chr "Andersen, A., Bagger, J. I., Sørensen, S. K., Baldassarre, M. P. A., Pedersen-Bjergaard, U., Forman, J. L., Gis"| __truncated__ "Raunsbæk Knudsen, L., Lomborg, K., Ndosi, M., Hauge, E-M. & de Thurah, A." "Laursen, J. C., Rasmussen, I. K. B., Zobel, E. H., Hasbak, P., von Scholten, B. J., Holmvang, L., Ripa, R. S., "| __truncated__ "Pitt, B., Filippatos, G., Agarwal, R., Anker, S. D., Bakris, G. L., Rossing, P., Joseph, A., Kolkhof, P., Nowac"| __truncated__ ...
## $ Reference: chr "In: Cardiovascular Diabetology. 20, 1, p. 241 241." "In: BMC Rheumatology. 5, 1, p. 57 57." "In: Frontiers in Endocrinology. 12, p. 780679 780679." "In: The New England journal of medicine. 385, 24, p. 2252-2263 12 p." ...
utils::sessionInfo()
## R version 4.0.4 (2021-02-15)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19042)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] sna_2.6 highr_0.9 pillar_1.6.2
## [4] compiler_4.0.4 jquerylib_0.1.4 tools_4.0.4
## [7] digest_0.6.27 lattice_0.20-41 viridisLite_0.4.0
## [10] jsonlite_1.7.2 evaluate_0.14 lifecycle_1.0.0
## [13] tibble_3.0.6 gtable_0.3.0 pkgconfig_2.0.3
## [16] rlang_0.4.11 crosstalk_1.1.1 yaml_2.2.1
## [19] xfun_0.27 coda_0.19-4 stringr_1.4.0
## [22] dplyr_1.0.4 httr_1.4.2 knitr_1.34
## [25] generics_0.1.0 vctrs_0.3.8 htmlwidgets_1.5.4
## [28] rprojroot_2.0.2 grid_4.0.4 tidyselect_1.1.1
## [31] glue_1.4.2 data.table_1.13.6 here_1.0.1
## [34] R6_2.5.1 fansi_0.4.2 plotly_4.9.4.1
## [37] rmarkdown_2.11 farver_2.1.0 tidyr_1.1.2
## [40] ggplot2_3.3.5 purrr_0.3.4 magrittr_2.0.1
## [43] ggthemes_4.2.4 scales_1.1.1 ellipsis_0.3.2
## [46] htmltools_0.5.1.1 colorspace_2.0-0 labeling_0.4.2
## [49] utf8_1.1.4 stringi_1.5.3 network_1.17.1
## [52] ggnetwork_0.5.10 lazyeval_0.2.2 munsell_0.5.0
## [55] statnet.common_4.5.0 crayon_1.4.1
if ( file.exists( "README.html" ) ) {
system( command = "rm index.html" )
system( command = "cp README.html index.html" )
}
## [1] 0